<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<jsp:include page="../../include/base.jsp"></jsp:include>
	<jsp:include page="../../include/common.jsp"></jsp:include>
	<script type="text/javascript">
	var array=new Array();
	function parenttab(ids)
	{
		 window.parent.setTab(ids);
	}
	function getImgHtml(resPath,ids){
		var tpath=__rootUrl+"admin/resource/default/notfound.jpg";  
		var imgstr	= "<img src='"+__rootUrl+"upload/product-image"+resPath+"' " +
		"onerror=\"this.onerror=null;this.src='"+tpath+"'\" " +
		"onload='XMAppUtils.setImgSize12(this)' onclick=\"parenttab(\'"+ids+"\')\"/>";
		return imgstr;
	};
	</script>
	<style type="text/css">
	body{margin:0;padding:0;}
		ul.imglist{
			width:780px;
			height:230px;
			padding:0 0 10px 10px;
			margin:0;
			overflow:hidden; 
		}
		ul.imglist li{
			width:146px;
			height:105px;
			float:left;
			padding:10px 10px 0 0;
			margin:0;
			overflow:hidden; 
			list-style:none;
		}
		ul.imglist li img{width:146px;height:105px;overflow:hidden;margin:0;padidng:0;}
	</style>
  </head>
  <body>
  <ul class="imglist" id="ultable">
  </ul>
   <%
   String bgiId = request.getParameter("bgiId");
   String pageIndex = request.getParameter("pageIndex");
   String pageSize = request.getParameter("pageSize");
   if(bgiId!=null&&bgiId.length()>0&&pageIndex!=null&&pageSize!=null)
   {%>
   <script>
   $("#ultable").empty();
     $.ajax( {
		url : "../../../getGoodsPicture.do",
		type : "POST",
		data : {
			bgiId : '<%=bgiId%>',
			pageIndex:'<%=pageIndex%>',
			pageSize:'<%=pageSize%>'
		},
		cache : false,
		success : function(text) {
		    var zz=text.data;
		    window.parent.setTotalCount(parseInt(text.total));
			for(var i=0;i<10;i++)
			{
			if(i<zz.length)
			{
			array[i]=zz[i].bgpId;
			var dts = $('<li></li>');
			var st=getImgHtml(zz[i].bgpOriginal,zz[i].bgpId);
			dts.append(st);
			$("#ultable").append(dts);
			}
			else
			{
			var dts = $('<li></li>');
			$("#ultable").append(dts);
			}
		}
	},
	error : function(jqXHR, textStatus, errorThrown) {
		mini.alert(jqXHR.responseText, "系统提示", null);
	}
	});
   </script>
   <% 
   }
   %>
  </body>
</html>
